﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace Model
{
    [DataContract]
    public class Show
    {
        [DataMember]
        private Movie movie;
        [DataMember]
        private CinemaHall cinemaHall;
        [DataMember]
        private DateTime dateTimeStart;
        [DataMember]
        private DateTime dateTimeEnd;
        [DataMember]
        private List<Seat> seatsNotAvailable;
        [DataMember]
        private double pricePerTicket;

        public Show(Movie movie, CinemaHall cinemaHall, DateTime dateTimeStart, DateTime dateTimeEnd, List<Seat> seatsNotAvailable, double pricePerTicket)
        {
            this.movie = movie;
            this.cinemaHall = cinemaHall;
            this.dateTimeStart = dateTimeStart;
            this.dateTimeEnd = dateTimeEnd;
            this.seatsNotAvailable = seatsNotAvailable;
            this.pricePerTicket = pricePerTicket;
        }
        public Show(Movie movie, CinemaHall cinemaHall, DateTime dateTimeStart, DateTime dateTimeEnd,double pricePerTicket)
        {
            this.movie = movie;
            this.cinemaHall = cinemaHall;
            this.dateTimeStart = dateTimeStart;
            this.dateTimeEnd = dateTimeEnd;
            this.pricePerTicket = pricePerTicket;
        }

        public Show()
        {
            this.movie = null;
            this.cinemaHall = null;
            this.dateTimeStart = new DateTime(2000, 1, 1, 0, 0, 0);
            this.dateTimeEnd = new DateTime(2000, 1, 1, 1, 0, 0);
            this.seatsNotAvailable = new List<Seat>();

        }

        public double PricePerTicket
        {
            get { return pricePerTicket; }
            set { pricePerTicket = value; }
        }

        public Movie ThisMovie
        {
            get { return movie; }
            set { movie = value; }
        }

        public CinemaHall CinemaHall
        {
            get { return cinemaHall; }
            set { cinemaHall = value; }
        }

        public DateTime DateTimeStart
        {
            get { return dateTimeStart; }
            set { dateTimeStart = value; }
        }

        public DateTime DateTimeEnd
        {
            get { return dateTimeEnd; }
            set { dateTimeEnd = value; }
        }

        public List<Seat> SeatsNotAvailable
        {
            get { return seatsNotAvailable; }
            set { seatsNotAvailable = value; }
        }
        public override string ToString()
        {
            string movieTitle = ThisMovie.Title;
            if (movieTitle.Length < 5)
            {
                int length = movieTitle.Length;
                while (length < 15)
                {
                    movieTitle = movieTitle + " ";
                    length++;
                }
            }

            return "Film:" + this.movie.Title + "   Sal:" + this.cinemaHall.Name + "   Start:" + this.dateTimeStart + "   Slut:" + this.dateTimeEnd + "   Pris:" + this.pricePerTicket;
            
        }
    }
}
